package com.ebuy.shopping.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ebuy.shopping.mapper.OrderMapper;
import com.ebuy.shopping.model.Order;

@Service
public class OrderService implements IOrderService
{
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Order load(int id) throws Exception
    {
        return orderMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Order> getOrders() throws Exception
    {
        return orderMapper.getOrders();
    }

    @Override
    public int add(Order order) throws Exception
    {
        return orderMapper.insert(order);
    }

    @Override
    public int update(Order order) throws Exception
    {
        return orderMapper.updateByPrimaryKey(order);
    }

    @Override
    public List<Order> selectList() throws Exception
    {

        return orderMapper.selectList();

    }

    @Override
    public Order getOrdersByUserId() throws Exception
    {

        return orderMapper.getOrdersByUserId();

    }

    @Override
    public int deleteByPrimaryKey(int id) throws Exception
    {

        return orderMapper.deleteByPrimaryKey(id);

    }
}
